﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GameStepAzure.Models;

namespace GameStepAzure.Controllers
{
    [AllowAnonymous]
    public class DetailsController : Controller
    {
        //
        // GET: /Details/

        public ActionResult Index(int Id, String Consola, TipoProducto Tipo)
        {
            ViewBag.Accion = Consola;

            IFachadaProductos fachadaProductos = new FachadaProductos();
            Producto busca = new Producto { Id = Id, Consola = Consola, Tipo = Tipo };
            Producto res = fachadaProductos.BuscaProducto(busca);
            if (Request.UrlReferrer != null && (Session["returnUrl"] == null || Request.UrlReferrer.Equals(Request.Url) == false))
            {
                Session["returnUrl"] = Request.UrlReferrer;
            }
            else
            {
                Session["returnUrl"] = "/";
            }

            return View(res);
        }
    }
}
